import request from '@/utils/request'
import { ObjectType, ResponseDataPromise } from 'typings/interfaces'
import * as proxy from '@/constants/proxy'
import { Pagination } from '@/components/Records/types'

// 路段-参建单位接口

export const fetchRecordsRequest = (
  pagination: Omit<Pagination, 'total'>,
  data: ObjectType
): ResponseDataPromise<ObjectType> =>
  request({
    url: proxy.CHECC_API_BASE_DATA + '/bd-fixed-section-build-unit/page',
    method: 'post',
    data,
    params: pagination,
  })

export const createRecordRequest = (data: ObjectType): ResponseDataPromise<string> =>
  request({
    url: proxy.CHECC_API_BASE_DATA + '/bd-fixed-section-build-unit',
    method: 'post',
    data,
  })


export const editRecordRequest = (data: ObjectType): ResponseDataPromise<boolean> =>
  request({
    url: proxy.CHECC_API_BASE_DATA + '/bd-fixed-section-build-unit',
    method: 'put',
    data,
  })


export const deleteRecordsRequest = (ids: string[]): ResponseDataPromise<boolean> =>
  request({
    url: proxy.CHECC_API_BASE_DATA + '/bd-fixed-section-build-unit',
    method: 'delete',
    data: ids,
  })

